import request from '@/utils/request'
const login = (data: any) => {
  return request({
    url: '/orgLogin/doLogin',
    method: 'POST',
    data,
  })
}
const singleLogin = (data: any) => {
  return request({
    url: '/orgLogin/tokenLogin',
    method: 'POST',
    data,
  })
}
const logout = (data: any) => {
  return request({
    url: '/ms/login/doSingleLogout',
    method: 'POST',
    data,
  })
}
const getCaptchaImage = (data: { id: string }) => {
  return request({
    url: '/orgLogin/getCaptcha',
    method: 'POST',
    data,
  })
}
const getUserMuenus = () => {
  return request({
    url: '/api/web/getTopMenuList',
    method: 'POST',
  })
}
const refreshToken = (data: { token: string }) => {
  return request({
    url: '/orgLogin/tokenLogin',
    method: 'POST',
    data,
  })
}
// 机构树型列表
const getOrgTresList = () => {
  return request({
    url: '/api/web/getOrgList',
    method: 'POST',
  })
}
const justLogin = (data: { token: string }) => {
  return request({
    url: '/orgLogin/justLogin',
    method: 'POST',
    data,
  })
}
const singleCreatOrg = (data: any) => {
  return request({
    url: '/home/org/create',
    method: 'POST',
    data,
  })
}
const singleChoseOrg = (data: any) => {
  return request({
    url: '/home/org/choose',
    method: 'POST',
    data,
  })
}
const loginApi = {
  login,
  singleLogin,
  logout,
  getCaptchaImage,
  refreshToken,
  getUserMuenus,
  getOrgTresList,
  justLogin,
  singleCreatOrg,
  singleChoseOrg,
}

export default loginApi
